﻿'*******************************************************************************************
'* Copyright Brügmann Software GmbH, Papenburg
'* Author: Björn Kremer
'* Contact: codeplex<at>patorg.de
'* 
'* VB.CMIS is a VB.NET implementation of the Content Management Interoperability Services (CMIS) standard
'*
'* This file is part of VB.CMIS.
'* 
'* VB.CMIS is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'* 
'* VB.CMIS is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'* GNU Lesser General Public License for more details.
'* 
'* You should have received a copy of the GNU Lesser General Public License
'* along with VB.CMIS. If not, see <http://www.gnu.org/licenses/>.
'*******************************************************************************************
Imports System.ServiceModel.Syndication
Namespace Atom
   Public Class CMISAtomFeed(Of T)

      Public Sub New(entries As List(Of CMISAtomEntry(Of T)), atomId As String, atomTitle As String, atomLastUpdatedTime As DateTimeOffset, atomAuthors As List(Of SyndicationPerson), hasMoreItems As Boolean, numItems As Integer?)
         _entries = entries
         _hasMoreItems = hasMoreItems
         _totalItemCount = numItems
         _atomId = atomId
         _atomLastUpdatedTime = atomLastUpdatedTime
         _atomTitle = atomTitle
         _atomAuthors = atomAuthors
      End Sub

      Private _atomId As String
      Public ReadOnly Property AtomId As String
         Get
            Return _atomId
         End Get
      End Property

      Private _atomTitle As String
      Public ReadOnly Property AtomTitle As String
         Get
            Return _atomTitle
         End Get
      End Property

      Private _atomLastUpdatedTime As DateTimeOffset
      Public ReadOnly Property AtomLastUpdatedTime As DateTimeOffset
         Get
            Return _atomLastUpdatedTime
         End Get
      End Property

      Private _atomAuthors As List(Of SyndicationPerson)
      Public ReadOnly Property AtomAuthors As List(Of SyndicationPerson)
         Get
            Return _atomAuthors
         End Get
      End Property

      Private _entries As New List(Of CMISAtomEntry(Of T))
      Public ReadOnly Property Entries As List(Of CMISAtomEntry(Of T))
         Get
            Return _entries
         End Get
      End Property

      Private _hasMoreItems As Boolean
      Public ReadOnly Property HasMoreItems() As Boolean
         Get
            Return _hasMoreItems
         End Get
      End Property

      Private _totalItemCount As Integer?
      Public ReadOnly Property TotalItemCount() As Integer?
         Get
            If _totalItemCount.HasValue AndAlso _totalItemCount = -1 Then
               Return _entries.Count
            End If
            Return _totalItemCount
         End Get
      End Property

   End Class
End Namespace